#include "folder.h"

#include <QDir>

namespace Avd {

Folder::Folder(const QString& name, const QString& path, const QString& modDate, unsigned int itens)
		: name(name), path(QDir::cleanPath(path)), modDate(QDateTime::fromString(modDate,Qt::ISODate)), itens(itens) { }


Folder::Folder(QString& pathName, unsigned int itens) : itens(itens) {
	int lastBarPos = pathName.lastIndexOf("/");
	name = pathName.right(pathName.size() - lastBarPos - 1);
	pathName.resize(lastBarPos + 1);
	path = QDir::cleanPath(pathName);
}

Folder::Folder(const QString& _pathName, unsigned int itens) : itens(itens) {
	QString pathName(_pathName);
	int lastBarPos = pathName.lastIndexOf("/");
	name = pathName.right(pathName.size() - lastBarPos - 1);
	pathName.resize(lastBarPos + 1);
	path = QDir::cleanPath(pathName);
}

QString Folder::getFullPath() const { return QDir::cleanPath(path + "/" + name); }

}

